<?php

namespace App\Http\Requests;

class CertificationRequest extends BaseRequest
{
    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        return [
            'name' => 'required',
            'mobile' => 'required|regex:/^1[3456789]{1}\d{9}$/|unique:users,phone',
        ];
    }

    public function messages()
    {
        return [
            'name.required' => '昵称 不能为空',

            'mobile.required' => '手机号 不能为空',
            'mobile.regex' => '手机号 格式不正确',
            'mobile.unique' => '手机号 已存在',
        ];
    }
}
